package com.shop.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import com.shop.dao.EmpDao;
import com.shop.entity.Emp;
@Repository
public class EmpDaoImpl implements EmpDao {
	@Resource
	private SessionFactory sessionFactory;
	@Override
	public List<Emp> findAll() {
		Query<Emp> query = sessionFactory.getCurrentSession().createQuery("from Emp", Emp.class);
		 List<Emp> list = query.getResultList();
		return list;
	}
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

	
}
